home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / DINKDEMO / DINKCLAS / DAPPLICA.H next >
Text File  |  1992-07-08  |  2KB  |  138 lines

  1. /*
  2.     File:        DApplication.h
  3.  
  4.     Written by:    Mark Gross
  5.  
  6.     Copyright:    ⌐ 1992 by Applied Technical Software, all rights reserved.
  7.     Use at your own risk.
  8.  
  9. */
  10.  
  11. // This is the class declaration of the DApplication class.
  12. #ifndef __DAPPLICATION__
  13. #define __DAPPLICATION__
  14.  
  15. #include "DListStuff.h"
  16. #include "DEventHandler.h"
  17. class DDocument; // forward declaration 
  18.  
  19. class DApplication : public DEventHandler
  20. {
  21.  
  22. public:
  23.  
  24.     Boolean fInBackground;
  25.  
  26. protected:
  27.  
  28.     unsigned long    fSleepVal;
  29.     RgnHandle fCursorRgn;
  30.     DEventHandler*    fTarget;
  31.     
  32.     DList*  fEventHandlers;
  33.  
  34.             
  35.     DList* fDeadHandlers;
  36.  
  37.             
  38.     Boolean FlushDeadHandlers(void);
  39.  
  40.     virtual void MouseDown(EventRecord *theEvent);
  41.  
  42.         
  43.     virtual void NullEvent(EventRecord *theEvent);
  44.     virtual void ActivateEvt(EventRecord *theEvent);
  45.  
  46.  
  47.     virtual void AutoKey(EventRecord *theEvent);
  48.     virtual void KeyDown(EventRecord *theEvent);                    
  49.  
  50.     virtual void DiskEvt(EventRecord *theEvent);
  51.  
  52.     virtual void HighLevelEvent(EventRecord *theEvent);
  53.     virtual void OSEvent(EventRecord *theEvent);
  54.     virtual void UpdateEvt(EventRecord *theEvent);
  55.     
  56. public:
  57.     
  58.     Boolean fDone;
  59.     Boolean InitApp(void);
  60.  
  61.     
  62.     Boolean InstalHandler( DEventHandler *addMe);
  63.     Boolean RemoveHandler( DEventHandler *killMe);
  64.  
  65.             
  66.     void EventLoop(void);
  67.  
  68.         
  69.     void CleanUp(void);    
  70.  
  71.     virtual void HandleMenuChoice(short menuID, short menuItem);            
  72.     virtual void SetUpMenues(void);
  73.     
  74. protected:
  75.     
  76.     virtual void ClearMenus(void);
  77.  
  78.  
  79. public:
  80.  
  81.     OSType        fCreator;
  82.     OSType        fClipType;
  83.     OSType        fMainFileType;
  84.  
  85.  
  86.     Handle    fClipData;
  87.  
  88.     
  89.     virtual DDocument* MakeDDoc(Boolean OpenFromFile);
  90.  
  91.  
  92.     virtual int GetFileType(OSType *typeList);
  93.  
  94.         
  95. private:
  96.     
  97.     void    GetClipFromSystem(void);
  98.     void    GiveClipToSystem(void);
  99.     
  100. public:
  101.     Handle    GetClipCopyFromApp(OSType *type);
  102.  
  103.         
  104.     void    GiveDataToApp(Handle data, OSType type);
  105.  
  106.     
  107. };//end of class declaration
  108.  
  109. #define SLEEPVAL 9
  110. #define BACKGROUNDSLEEP 0x0FFFFFFF
  111. #define kDITop 0x0050
  112. #define kDILeft 0x0070
  113.  
  114. #define    rMenuBarID    128
  115. #define rAppleMenu    128
  116. #define    rFileMenu    129
  117. #define    rAboutIDBox    128
  118.  
  119. #define iAbout    1
  120.  
  121. #define    iNew    1
  122. #define    iOpen    2
  123. #define    iClose        4
  124. #define    iSave        5
  125. #define    iSaveAs        6
  126. #define    iPageSetup    8
  127. #define    iPrint        9
  128. #define    iQuit    11
  129.  
  130. #define    rEditMenu        130
  131. #define    iUndo        1
  132. #define    iCut        3
  133. #define    iCopy        4
  134. #define iPaste        5
  135. #define    iClear        6
  136. #define    iSelectAll    8
  137.  
  138. #endif __DAPPLICATION__